﻿using ClientWPF.BankService;

namespace ClientWPF
{
    public class Generators
    {
        private readonly BankServiceClient bankServiceClient;

        public Generators(BankServiceClient bankServiceClient)
        {
            this.bankServiceClient = bankServiceClient;
        }

        public int PaymentOrderNumberGenerator(decimal unp)
        {
            int? maxNumber = bankServiceClient.GetMaxPaymentOrderNumber(unp);
            if (maxNumber == null)
            {
                return 1;
            }
            maxNumber++;
            return (int)maxNumber;
        }
    }
}